const path = require('path');
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const webpack = require('webpack')
module.exports = {
// mode: 'development',
    //指定入口文件: 打包入口
    entry: path.join(__dirname,'./src/main.js'),
    //打包出口
    output:{
        path: path.join(__dirname,'./dist'),
        filename: 'bundle.js'
    },
    devtool: 'inline-source-map',
    devServer:{
        open:true,
        host:'localhost',
        port:8005,
        contentBase:'src',
        hot:true
    },
    module:{
        rules:[
            {test:/\.vue$/,use:'vue-loader'},
            {test:/\.css$/,use:['style-loader','css-loader']},
            {test:/\.scss$/,use:['style-loader','css-loader','scss-loader']},
            {test:/\.less$/,use:['style-loader','css-loader','less-loader']},
            {test:/\.(jpg|jpeg|png|svg|tff|eot|svg|woff|woff2|ttf)$/,use:'url-loader?limit=7632&name=[hash:8]-[name].[ext]&esModule=false'},
            {test:/\.js$/,use:'babel-loader',exclude:/node_module/},
        ]
    },
    plugins:[
        new VueLoaderPlugin(),
        new webpack.HotModuleReplacementPlugin(),
        new HtmlWebpackPlugin({
            template:path.join(__dirname,'./index.html'),
            filename:'index.html'
        })
    ],
}
